home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / fido / tdisp11.lha / TrapDispatcher / Rexx / Deliver.rexx < prev    next >
OS/2 REXX Batch file  |  1994-11-15  |  2KB  |  101 lines

  1. /*
  2.  
  3.    Deliver.rexx 1.0
  4.  
  5.    This script scans your outbound directory for mail bundles and/or
  6.    filerequests and calls the node they are destined for.
  7.  
  8.    Deliver only recognizes a 4D-style outbound directory, that is the
  9.    files should be named zone.net.node.point.*. Does anybode use the old
  10.    2D-style anyway?
  11.  
  12.    Usage: rx Deliver.rexx [+D] [+C] [+N] [+R] <options>
  13.  
  14.    +D          Send direct mail
  15.    +C          Send crashmail
  16.    +N          Send normal mail
  17.    +R          Send filerequests
  18.  
  19.    <options>   Options that are passed to TrapDispatcher
  20.  
  21.    Example: rx Deliver.rexx +C +D UNTIL 04:30
  22.  
  23. */
  24.  
  25. /* Change these to suit your system */
  26.  
  27. dispatchport="TRAPDISPATCHER"
  28. outbound="MAIL:Outbound"
  29.  
  30. /* Real script starts here */
  31.  
  32. options results
  33. options failat 11 /* Don't show error 10 in CLI... */
  34.  
  35. IF ~SHOW(Libraries,'rexxsupport.library') THEN
  36.     IF ~ADDLIB("rexxsupport.library",0,-30,0) THEN EXIT
  37.  
  38. buf=arg(1)
  39. opt=""
  40.  
  41. parse var buf option buf
  42.  
  43. do while option~=""
  44.  if left(option,1)="+" then do
  45.   if upper(left(option,2))="+N" then sendflo=TRUE
  46.   else if upper(left(option,2))="+R" then sendreq=TRUE
  47.   else if upper(left(option,2))="+D" then senddlo=TRUE
  48.   else if upper(left(option,2))="+C" then sendclo=TRUE
  49.   else do
  50.    say "Unknown option" option
  51.    exit
  52.   end
  53.  end
  54.  else do
  55.  
  56.   /* Join other options so that we can pass them to TrapDispatcher */
  57.  
  58.   if opt~="" then opt=opt || " "
  59.   opt=opt || option
  60.  end
  61.  parse var buf option buf
  62. end
  63.  
  64. address command "List lformat %s PAT #?.#?.#?.#?.(REQ|FLO|DLO|CLO) >T:Deliver.tmp " || outbound
  65.  
  66. call open('file','T:Deliver.tmp','R')
  67.  
  68. do while ~eof('file')
  69.  buf=readln('file')
  70.  
  71.  if buf~="" then do
  72.  
  73.   /* Separate dotted node number from extenssion */
  74.  
  75.   ext=right(buf,3)
  76.   main=left(buf,length(buf)-4)
  77.  
  78.   /* Make FidoNet address */
  79.  
  80.   parse var main zone"."net"."node"."point
  81.   addr=zone":"net"/"node"."point
  82.  
  83.   send=false
  84.  
  85.   if upper(ext)="REQ" & sendreq=true then send=TRUE
  86.   if upper(ext)="FLO" & sendflo=true then send=TRUE
  87.   if upper(ext)="DLO" & senddlo=true then send=TRUE
  88.   if upper(ext)="CLO" & sendclo=true then send=TRUE
  89.  
  90.   if send=true then do
  91.    address value dispatchport
  92.    'call 'addr' 'opt
  93.    geterror
  94.    say addr || ", " || result
  95.   end
  96.  end
  97. end
  98.  
  99. call close('file')
  100. call delete('T:Deliver.tmp')
  101.